package com.huike.web.controller.report;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.huike.business.domain.TbBusiness;
import com.huike.business.service.TbBusinessService;
import com.huike.clues.domain.TbClue;
import com.huike.clues.service.TbClueService;
import com.huike.common.result.Result;
import com.huike.report.domain.vo.BusinessChangeStatisticsVO;
import com.huike.report.domain.vo.IndexBaseInfoVO;
import com.huike.report.domain.vo.IndexTodayInfoVO;
import com.huike.report.domain.vo.IndexTodoInfoVO;
import com.huike.report.dto.BusinessChangeStatisticsDTO;
import com.huike.report.service.IndexService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @Description 首页报表相关接口
 * @Date 2023-10-10
 */

@RestController
@RequestMapping("/index")
@Slf4j
@RequiredArgsConstructor
public class IndexController {
    private final IndexService indexService;

    @GetMapping("/businessChangeStatistics")
    public Result<List<BusinessChangeStatisticsVO>> getBusinessChangeStatistics(BusinessChangeStatisticsDTO businessChangeStatisticsDTO){
        List<BusinessChangeStatisticsVO> businessChangeStatisticsVOs = indexService.getBusinessChangeStatistics(businessChangeStatisticsDTO);
        return Result.success(businessChangeStatisticsVOs);
    }

    @GetMapping("/salesStatistic")
    public Result<List<BusinessChangeStatisticsVO>> getSalesStatistic(BusinessChangeStatisticsDTO businessChangeStatisticsDTO){
        List<BusinessChangeStatisticsVO> businessChangeStatisticsVOs = indexService.getSalesStatistic(businessChangeStatisticsDTO);
        return Result.success(businessChangeStatisticsVOs);
    }

    @GetMapping("/getTodayInfo")
    public Result<IndexTodayInfoVO> getTodayInfo(BusinessChangeStatisticsDTO businessChangeStatisticsDTO){
        IndexTodayInfoVO baseInfo = indexService.getTodayInfo(businessChangeStatisticsDTO);
        return Result.success(baseInfo);
    }

    @GetMapping("/getBaseInfo")
    public Result<IndexBaseInfoVO> getBaseInfo(BusinessChangeStatisticsDTO businessChangeStatisticsDTO){
        IndexBaseInfoVO baseInfo = indexService.getBaseInfo(businessChangeStatisticsDTO);
        return Result.success(baseInfo);
    }
    @GetMapping("/getTodoInfo")
    public Result<IndexTodoInfoVO> getTodoInfo(BusinessChangeStatisticsDTO businessChangeStatisticsDTO){
        IndexTodoInfoVO indexTodoInfoVO = indexService.getTodoInfo(businessChangeStatisticsDTO);
        return Result.success(indexTodoInfoVO);
    }
}
